package com.jjyd.crlp.model.dto.word;

import com.jjyd.crlp.domain.entity.Dictionary;
import com.jjyd.crlp.domain.entity.type.LanguageType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 查询单词结果
 */
@Data
@ApiModel("查询单词结果")
public class WordDto {

    /**
     * 单词主键id
     */
    @ApiModelProperty(value = "单词主键id")
    private Integer id;

    /**
     * 目标语言
     */
    @ApiModelProperty(value = "目标语言")
    private String targetLanguage;

    /**
     * 目标语言类型
     */
    @ApiModelProperty(value = "目标语言类型")
    private LanguageType targetLanguageType;


    /**
     * 原始语言
     */
    @ApiModelProperty(value = "原始语言")
    private String originalLanguage;

    /**
     * 原始语言类型
     */
    @ApiModelProperty(value = "原始语言类型")
    private LanguageType originalLanguageType;

    /**
     * 例句
     */
    @ApiModelProperty(value = "例句")
    private String example;


    /**
     * 实体类转为dto信息
     * @param dictionary 实体对象
     */
    public WordDto(Dictionary dictionary) {
        this.id = dictionary.getId();
        this.example = dictionary.getExample();
        this.originalLanguage = dictionary.getOriginalLanguage();
        this.originalLanguageType = dictionary.getOriginalLanguageType();
        this.targetLanguage = dictionary.getTargetLanguage();
        this.targetLanguageType = dictionary.getTargetLanguageType();
    }


}
